.class public Lcom/glympse/platform/LocManager$ProviderGps;
.super Ljava/lang/Object;
.source "LocManager.java"

# interfaces
.implements Landroid/location/LocationListener;


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/glympse/platform/LocManager;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x4
    name = "ProviderGps"
.end annotation


# instance fields
.field protected m_fRunning:Z

.field final synthetic this$0:Lcom/glympse/platform/LocManager;


# direct methods
.method protected constructor <init>(Lcom/glympse/platform/LocManager;)V
    .locals 1
    .parameter

    .prologue
    .line 488
    iput-object p1, p0, Lcom/glympse/platform/LocManager$ProviderGps;->this$0:Lcom/glympse/platform/LocManager;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 490
    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/glympse/platform/LocManager$ProviderGps;->m_fRunning:Z

    return-void
.end method


# virtual methods
.method protected Start()Z
    .locals 7

    .prologue
    .line 498
    :try_start_0
    iget-object v0, p0, Lcom/glympse/platform/LocManager$ProviderGps;->this$0:Lcom/glympse/platform/LocManager;

    iget-object v0, v0, Lcom/glympse/platform/LocManager;->m_oLocationManager:Landroid/location/LocationManager;

    if-nez v0, :cond_0

    .line 500
    iget-object v1, p0, Lcom/glympse/platform/LocManager$ProviderGps;->this$0:Lcom/glympse/platform/LocManager;

    invoke-static {}, Lcom/glympse/platform/Platform;->instance()Lcom/glympse/platform/Platform;

    sget-object v0, Lcom/glympse/platform/Platform;->m_oContext:Landroid/content/Context;

    const-string v2, "location"

    invoke-virtual {v0, v2}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/location/LocationManager;

    iput-object v0, v1, Lcom/glympse/platform/LocManager;->m_oLocationManager:Landroid/location/LocationManager;

    .line 503
    :cond_0
    iget-boolean v0, p0, Lcom/glympse/platform/LocManager$ProviderGps;->m_fRunning:Z

    if-nez v0, :cond_1

    .line 505
    const-string v0, "Starting GPS Provider"

    invoke-static {v0}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/String;)V

    .line 508
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/glympse/platform/LocManager$ProviderGps;->m_fRunning:Z

    .line 511
    iget-object v0, p0, Lcom/glympse/platform/LocManager$ProviderGps;->this$0:Lcom/glympse/platform/LocManager;

    iget-object v0, v0, Lcom/glympse/platform/LocManager;->m_oLocationManager:Landroid/location/LocationManager;

    const-string v1, "gps"

    const-wide/16 v2, 0x0

    const/4 v4, 0x0

    move-object v5, p0

    invoke-virtual/range {v0 .. v5}, Landroid/location/LocationManager;->requestLocationUpdates(Ljava/lang/String;JFLandroid/location/LocationListener;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 520
    :cond_1
    :goto_0
    iget-boolean v0, p0, Lcom/glympse/platform/LocManager$ProviderGps;->m_fRunning:Z

    return v0

    .line 514
    :catch_0
    move-exception v0

    move-object v6, v0

    .line 516
    .local v6, e:Ljava/lang/Exception;
    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/glympse/platform/LocManager$ProviderGps;->m_fRunning:Z

    .line 517
    invoke-static {v6}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/Throwable;)V

    goto :goto_0
.end method

.method protected Stop()V
    .locals 3

    .prologue
    const/4 v2, 0x0

    .line 526
    iget-boolean v1, p0, Lcom/glympse/platform/LocManager$ProviderGps;->m_fRunning:Z

    if-eqz v1, :cond_0

    iget-object v1, p0, Lcom/glympse/platform/LocManager$ProviderGps;->this$0:Lcom/glympse/platform/LocManager;

    iget-object v1, v1, Lcom/glympse/platform/LocManager;->m_oLocationManager:Landroid/location/LocationManager;

    if-eqz v1, :cond_0

    .line 528
    const-string v1, "Stopping GPS Provider"

    invoke-static {v1}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/String;)V

    .line 531
    :try_start_0
    iget-object v1, p0, Lcom/glympse/platform/LocManager$ProviderGps;->this$0:Lcom/glympse/platform/LocManager;

    iget-object v1, v1, Lcom/glympse/platform/LocManager;->m_oLocationManager:Landroid/location/LocationManager;

    invoke-virtual {v1, p0}, Landroid/location/LocationManager;->removeUpdates(Landroid/location/LocationListener;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 537
    :goto_0
    iput-boolean v2, p0, Lcom/glympse/platform/LocManager$ProviderGps;->m_fRunning:Z

    .line 541
    :cond_0
    iget-object v1, p0, Lcom/glympse/platform/LocManager$ProviderGps;->this$0:Lcom/glympse/platform/LocManager;

    invoke-virtual {v1}, Lcom/glympse/platform/LocManager;->StopGpsIdleTimer()V

    .line 542
    iget-object v1, p0, Lcom/glympse/platform/LocManager$ProviderGps;->this$0:Lcom/glympse/platform/LocManager;

    iput-boolean v2, v1, Lcom/glympse/platform/LocManager;->m_fGps:Z

    .line 543
    return-void

    .line 533
    :catch_0
    move-exception v1

    move-object v0, v1

    .line 535
    .local v0, e:Ljava/lang/Exception;
    invoke-static {v0}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/Throwable;)V

    goto :goto_0
.end method

.method public onLocationChanged(Landroid/location/Location;)V
    .locals 4
    .parameter "oLocation"

    .prologue
    .line 548
    if-eqz p1, :cond_0

    .line 553
    :try_start_0
    iget-object v1, p0, Lcom/glympse/platform/LocManager$ProviderGps;->this$0:Lcom/glympse/platform/LocManager;

    invoke-virtual {v1}, Lcom/glympse/platform/LocManager;->StopGpsIdleTimer()V

    .line 556
    iget-object v1, p0, Lcom/glympse/platform/LocManager$ProviderGps;->this$0:Lcom/glympse/platform/LocManager;

    const/4 v2, 0x1

    iput-boolean v2, v1, Lcom/glympse/platform/LocManager;->m_fGps:Z

    .line 559
    iget-object v1, p0, Lcom/glympse/platform/LocManager$ProviderGps;->this$0:Lcom/glympse/platform/LocManager;

    invoke-virtual {v1}, Lcom/glympse/platform/LocManager;->StopProviderSkyhook()V

    .line 560
    iget-object v1, p0, Lcom/glympse/platform/LocManager$ProviderGps;->this$0:Lcom/glympse/platform/LocManager;

    invoke-virtual {v1}, Lcom/glympse/platform/LocManager;->StopProviderNetwork()V

    .line 562
    iget-object v1, p0, Lcom/glympse/platform/LocManager$ProviderGps;->this$0:Lcom/glympse/platform/LocManager;

    iget-object v2, p0, Lcom/glympse/platform/LocManager$ProviderGps;->this$0:Lcom/glympse/platform/LocManager;

    const/4 v3, 0x1

    invoke-virtual {v2, p1, v3}, Lcom/glympse/platform/LocManager;->CreateLocPoint(Landroid/location/Location;I)Lcom/glympse/platform/common/LocPoint;

    move-result-object v2

    invoke-virtual {v1, v2}, Lcom/glympse/platform/LocManager;->AddLocation(Lcom/glympse/platform/common/LocPoint;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 569
    :cond_0
    :goto_0
    return-void

    .line 564
    :catch_0
    move-exception v1

    move-object v0, v1

    .line 566
    .local v0, e:Ljava/lang/Exception;
    invoke-static {v0}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/Throwable;)V

    goto :goto_0
.end method

.method public onProviderDisabled(Ljava/lang/String;)V
    .locals 1
    .parameter "provider"

    .prologue
    .line 574
    iget-object v0, p0, Lcom/glympse/platform/LocManager$ProviderGps;->this$0:Lcom/glympse/platform/LocManager;

    invoke-virtual {v0}, Lcom/glympse/platform/LocManager;->StartGpsIdleTimer()V

    .line 575
    return-void
.end method

.method public onProviderEnabled(Ljava/lang/String;)V
    .locals 0
    .parameter "provider"

    .prologue
    .line 580
    return-void
.end method

.method public onStatusChanged(Ljava/lang/String;ILandroid/os/Bundle;)V
    .locals 1
    .parameter "strProvider"
    .parameter "nStatus"
    .parameter "oExtras"

    .prologue
    .line 591
    const/4 v0, 0x2

    if-eq v0, p2, :cond_0

    .line 593
    iget-object v0, p0, Lcom/glympse/platform/LocManager$ProviderGps;->this$0:Lcom/glympse/platform/LocManager;

    invoke-virtual {v0}, Lcom/glympse/platform/LocManager;->StartGpsIdleTimer()V

    .line 595
    :cond_0
    return-void
.end method
